import { requestClient } from '#/api/request';

export interface updateSubjectParams {
  id: string;
  name: string;
  pid?: string;
}

/**
 * 修改科目分类信息
 */
export async function updateSubjectCategoryApi(data: updateSubjectParams) {
  return requestClient.post('/course/update-subject-category', { id: data.id, name: data.name, pid: data.pid });
}

export interface updateSubjectParams {
  name: string;
  pid?: string;
}

/**
 * 创建科目分类信息
 **/
export async function createSubjectCategoryApi(data: updateSubjectParams) {
  return requestClient.post('/course/create-subject-category', { name: data.name, pid: data.pid });
}

/**
* 查询科目分类树分页列表
**/
export async function getSubjectTreeListApi(params: Record<string, any>) {
  return requestClient.get('/course/get-subject-category-tree-list', { params });
}

/**
 * 删除科目分类信息
 */
export async function delSubjectCategoryApi(data: any) {
  return requestClient.delete(`/course/delete-subject-category/${data.id}`);
}
